home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / MPW / flex 2.4.6 / flex.skl < prev    next >
Encoding:
Text File  |  1994-01-29  |  26.6 KB  |  1,225 lines  |  [TEXT/MPS ]

  1. /* A lexical scanner generated by flex */
  2.  
  3. /* Scanner skeleton version:
  4.  * $Header: flex.skl,v 1.2 94/01/04 14:33:15 vern Exp $
  5.  */
  6.  
  7. #define FLEX_SCANNER
  8.  
  9. %-
  10. #include <stdio.h>
  11.  
  12. #ifdef macintosh
  13. #ifndef fileno
  14. #define fileno(p)    (p)->_file
  15. #endif
  16. #include <ioctl.h>
  17. #define isatty(fd)    (ioctl(fd, FIOINTERACTIVE, NULL) == 0)
  18. #endif
  19. %*
  20.  
  21.  
  22. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  23. #ifdef c_plusplus
  24. #ifndef __cplusplus
  25. #define __cplusplus
  26. #endif
  27. #endif
  28.  
  29.  
  30. #ifdef __cplusplus
  31.  
  32. #include <stdlib.h>
  33. %+
  34. class istream;
  35. %*
  36. #include <unistd.h>
  37.  
  38. /* Use prototypes in function declarations. */
  39. #define YY_USE_PROTOS
  40.  
  41. /* The "const" storage-class-modifier is valid. */
  42. #define YY_USE_CONST
  43.  
  44. #else    /* ! __cplusplus */
  45.  
  46. #if defined(__STDC__) || defined(macintosh) || defined(THINK_C)
  47.  
  48. #define YY_USE_PROTOS
  49. #define YY_USE_CONST
  50.  
  51. #endif    /* __STDC__ */
  52. #endif    /* ! __cplusplus */
  53.  
  54.  
  55. #ifdef __TURBOC__
  56. #define YY_USE_CONST
  57. #endif
  58.  
  59.  
  60. #ifndef YY_USE_CONST
  61. #ifndef const
  62. #define const
  63. #endif
  64. #endif
  65.  
  66.  
  67. #ifdef YY_USE_PROTOS
  68. #define YY_PROTO(proto) proto
  69. #else
  70. #define YY_PROTO(proto) ()
  71. #endif
  72.  
  73. /* Returned upon end-of-file. */
  74. #define YY_NULL 0
  75.  
  76. /* Promotes a possibly negative, possibly signed char to an unsigned
  77.  * integer for use as an array index.  If the signed char is negative,
  78.  * we want to instead treat it as an 8-bit unsigned char, hence the
  79.  * double cast.
  80.  */
  81. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  82.  
  83. /* Enter a start condition.  This macro really ought to take a parameter,
  84.  * but we do it the disgusting crufty way forced on us by the ()-less
  85.  * definition of BEGIN.
  86.  */
  87. #define BEGIN yy_start = 1 + 2 *
  88.  
  89. /* Translate the current start state into a value that can be later handed
  90.  * to BEGIN to return to the state.
  91.  */
  92. #define YY_START ((yy_start - 1) / 2)
  93.  
  94. /* Action number for EOF rule of a given start state. */
  95. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  96.  
  97. /* Special action meaning "start processing a new file".  Now included
  98.  * only for backward compatibility with previous versions of flex.
  99.  */
  100. #define YY_NEW_FILE yyrestart( yyin )
  101.  
  102. #define YY_END_OF_BUFFER_CHAR 0
  103.  
  104. /* Size of default input buffer. */
  105. #define YY_BUF_SIZE 16384
  106.  
  107. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  108.  
  109. extern int yyleng;
  110. %-
  111. extern FILE *yyin, *yyout;
  112. %*
  113.  
  114. #ifdef __cplusplus
  115. extern "C" {
  116. #endif
  117.     extern int yywrap YY_PROTO(( void ));
  118. #ifdef __cplusplus
  119.     }
  120. #endif
  121.  
  122. #define EOB_ACT_CONTINUE_SCAN 0
  123. #define EOB_ACT_END_OF_FILE 1
  124. #define EOB_ACT_LAST_MATCH 2
  125.  
  126. /* The funky do-while in the following #define is used to turn the definition
  127.  * int a single C statement (which needs a semi-colon terminator).  This
  128.  * avoids problems with code like:
  129.  *
  130.  *     if ( condition_holds )
  131.  *        yyless( 5 );
  132.  *    else
  133.  *        do_something_else();
  134.  *
  135.  * Prior to using the do-while the compiler would get upset at the
  136.  * "else" because it interpreted the "if" statement as being all
  137.  * done when it reached the ';' after the yyless() call.
  138.  */
  139.  
  140. /* Return all but the first 'n' matched characters back to the input stream. */
  141.  
  142. #define yyless(n) \
  143.     do \
  144.         { \
  145.         /* Undo effects of setting up yytext. */ \
  146.         *yy_cp = yy_hold_char; \
  147.         yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
  148.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  149.         } \
  150.     while ( 0 )
  151.  
  152. #define unput(c) yyunput( c, yytext_ptr )
  153.  
  154.  
  155. struct yy_buffer_state
  156.     {
  157. %-
  158.     FILE *yy_input_file;
  159. %+
  160.     istream* yy_input_file;
  161. %*
  162.  
  163.     char *yy_ch_buf;        /* input buffer */
  164.     char *yy_buf_pos;        /* current position in input buffer */
  165.  
  166.     /* Size of input buffer in bytes, not including room for EOB
  167.      * characters.
  168.      */
  169.     int yy_buf_size;
  170.  
  171.     /* Number of characters read into yy_ch_buf, not including EOB
  172.      * characters.
  173.      */
  174.     int yy_n_chars;
  175.  
  176.     /* Whether this is an "interactive" input source; if so, and
  177.      * if we're using stdio for input, then we want to use getc()
  178.      * instead of fread(), to make sure we stop fetching input after
  179.      * each newline.
  180.      */
  181.     int yy_is_interactive;
  182.  
  183.     /* Whether to try to fill the input buffer when we reach the
  184.      * end of it.
  185.      */
  186.     int yy_fill_buffer;
  187.  
  188.     /* Whether we've seen an EOF on this buffer. */
  189.     int yy_eof_status;
  190. #define EOF_NOT_SEEN 0
  191.     /* "Pending" happens when the EOF has been seen but there's still
  192.      * some text to process.  Note that when we actually see the EOF,
  193.      * we switch the status back to "not seen" (via yyrestart()), so
  194.      * that the user can continue scanning by just pointing yyin at
  195.      * a new input file.
  196.      */
  197. #define EOF_PENDING 1
  198.     };
  199.  
  200. %- Standard (non-C++) definition
  201. static YY_BUFFER_STATE yy_current_buffer = 0;
  202. %*
  203.  
  204. /* We provide macros for accessing buffer states in case in the
  205.  * future we want to put the buffer states in a more general
  206.  * "scanner state".
  207.  */
  208. #define YY_CURRENT_BUFFER yy_current_buffer
  209.  
  210.  
  211. %- Standard (non-C++) definition
  212. /* yy_hold_char holds the character lost when yytext is formed. */
  213. static char yy_hold_char;
  214.  
  215. static int yy_n_chars;        /* number of characters read into yy_ch_buf */
  216.  
  217.  
  218. int yyleng;
  219.  
  220. /* Points to current character in buffer. */
  221. static char *yy_c_buf_p = (char *) 0;
  222. static int yy_init = 1;        /* whether we need to initialize */
  223. static int yy_start = 0;    /* start state number */
  224.  
  225. /* Flag which is used to allow yywrap()'s to do buffer switches
  226.  * instead of setting up a fresh yyin.  A bit of a hack ...
  227.  */
  228. static int yy_did_buffer_switch_on_eof;
  229.  
  230. static void yyunput YY_PROTO(( int c, char *buf_ptr ));
  231. void yyrestart YY_PROTO(( FILE *input_file ));
  232. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  233. void yy_load_buffer_state YY_PROTO(( void ));
  234. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  235. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  236. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  237.  
  238. static int yy_start_stack_ptr = 0;
  239. static int yy_start_stack_depth = 0;
  240. static int *yy_start_stack = 0;
  241. static void yy_push_state YY_PROTO(( int new_state ));
  242. static void yy_pop_state YY_PROTO(( void ));
  243. static int yy_top_state YY_PROTO(( void ));
  244. %*
  245.  
  246. #ifndef yytext_ptr
  247. static void yy_flex_strcpy YY_PROTO(( char *, const char * ));
  248. #endif
  249.  
  250. static void *yy_flex_alloc YY_PROTO(( unsigned int ));
  251. static void *yy_flex_realloc YY_PROTO(( void *ptr, unsigned int ));
  252. static void yy_flex_free YY_PROTO(( void * ));
  253.  
  254. #define yy_new_buffer yy_create_buffer
  255.  
  256. %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
  257.  
  258. %- Standard (non-C++) definition
  259. #ifdef __cplusplus
  260. static int yyinput YY_PROTO(( void ));
  261. #else
  262. static int input YY_PROTO(( void ));
  263. #endif
  264. %*
  265.  
  266. %- Standard (non-C++) definition
  267. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  268. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  269. static int yy_get_next_buffer YY_PROTO(( void ));
  270. static void yy_fatal_error YY_PROTO(( const char msg[] ));
  271. %*
  272.  
  273. /* Done after the current pattern has been matched and before the
  274.  * corresponding action - sets up yytext.
  275.  */
  276. #define YY_DO_BEFORE_ACTION \
  277.     yytext_ptr = yy_bp; \
  278. %% code to fiddle yytext and yyleng for yymore() goes here
  279.     yy_hold_char = *yy_cp; \
  280.     *yy_cp = '\0'; \
  281. %% code to copy yytext_ptr to yytext[] goes here, if %array
  282.     yy_c_buf_p = yy_cp;
  283.  
  284. %% data tables for the DFA and the user's section 1 definitions go here
  285.  
  286. /* Macros after this point can all be overridden by user definitions in
  287.  * section 1.
  288.  */
  289.  
  290. #ifdef YY_MALLOC_DECL
  291. YY_MALLOC_DECL
  292. #else
  293. #if __STDC__
  294. #ifndef __cplusplus
  295. #include <stdlib.h>
  296. #endif
  297. #else
  298. /* Just try to get by without declaring the routines.  This will fail
  299.  * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
  300.  * or sizeof(void*) != sizeof(int).
  301.  */
  302. #endif
  303. #endif
  304.  
  305. /* Amount of stuff to slurp up with each read. */
  306. #ifndef YY_READ_BUF_SIZE
  307. #define YY_READ_BUF_SIZE 8192
  308. #endif
  309.  
  310. /* Copy whatever the last rule matched to the standard output. */
  311.  
  312. #ifndef ECHO
  313. %- Standard (non-C++) definition
  314. /* This used to be an fputs(), but since the string might contain NUL's,
  315.  * we now use fwrite().
  316.  */
  317. #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
  318. %+ C++ definition
  319. #define ECHO LexerOutput( yytext, yyleng )
  320. %*
  321. #endif
  322.  
  323. /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  324.  * is returned in "result".
  325.  */
  326. #ifndef YY_INPUT
  327. #define YY_INPUT(buf,result,max_size) \
  328. %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
  329. %+ C++ definition
  330.     if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
  331.         YY_FATAL_ERROR( "input in flex scanner failed" );
  332. %*
  333. #endif
  334.  
  335. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  336.  * we don't want an extra ';' after the "return" because that will cause
  337.  * some compilers to complain about unreachable statements.
  338.  */
  339. #ifndef yyterminate
  340. #define yyterminate() return YY_NULL
  341. #endif
  342.  
  343. /* Number of entries by which start-condition stack grows. */
  344. #ifndef YY_START_STACK_INCR
  345. #define YY_START_STACK_INCR 25
  346. #endif
  347.  
  348. /* Report a fatal error. */
  349. #ifndef YY_FATAL_ERROR
  350. %-
  351. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  352. %+
  353. #define YY_FATAL_ERROR(msg) LexerError( msg )
  354. %*
  355. #endif
  356.  
  357. /* Default declaration of generated scanner - a define so the user can
  358.  * easily add parameters.
  359.  */
  360. #ifndef YY_DECL
  361. %- Standard (non-C++) definition
  362. #define YY_DECL int yylex YY_PROTO(( void ))
  363. %+ C++ definition
  364. #define YY_DECL int yyFlexLexer::yylex()
  365. %*
  366. #endif
  367.  
  368. /* Code executed at the beginning of each rule, after yytext and yyleng
  369.  * have been set up.
  370.  */
  371. #ifndef YY_USER_ACTION
  372. #define YY_USER_ACTION
  373. #endif
  374.  
  375. /* Code executed at the end of each rule. */
  376. #ifndef YY_BREAK
  377. #define YY_BREAK break;
  378. #endif
  379.  
  380. YY_DECL
  381.     {
  382.     register yy_state_type yy_current_state;
  383.     register char *yy_cp, *yy_bp;
  384.     register int yy_act;
  385.  
  386. %% user's declarations go here
  387.  
  388.     if ( yy_init )
  389.         {
  390. #ifdef YY_USER_INIT
  391.         YY_USER_INIT;
  392. #endif
  393.  
  394.         if ( ! yy_start )
  395.             yy_start = 1;    /* first start state */
  396.  
  397.         if ( ! yyin )
  398. %-
  399.             yyin = stdin;
  400. %+
  401.             yyin = &cin;
  402. %*
  403.  
  404.         if ( ! yyout )
  405. %-
  406.             yyout = stdout;
  407. %+
  408.             yyout = &cout;
  409. %*
  410.  
  411.         if ( yy_current_buffer )
  412.             yy_init_buffer( yy_current_buffer, yyin );
  413.         else
  414.             yy_current_buffer =
  415.                 yy_create_buffer( yyin, YY_BUF_SIZE );
  416.  
  417.         yy_load_buffer_state();
  418.  
  419.         yy_init = 0;
  420.         }
  421.  
  422.     while ( 1 )        /* loops until end-of-file is reached */
  423.         {
  424. %% yymore()-related code goes here
  425.         yy_cp = yy_c_buf_p;
  426.  
  427.         /* Support of yytext. */
  428.         *yy_cp = yy_hold_char;
  429.  
  430.         /* yy_bp points to the position in yy_ch_buf of the start of
  431.          * the current run.
  432.          */
  433.         yy_bp = yy_cp;
  434.  
  435. %% code to set up and find next match goes here
  436.  
  437. yy_find_action:
  438. %% code to find the action number goes here
  439.  
  440.         YY_DO_BEFORE_ACTION;
  441.  
  442. %% code for yylineno update goes here, if -l option
  443.  
  444. do_action:    /* This label is used only to access EOF actions. */
  445.  
  446. %% debug code goes here
  447.  
  448.         switch ( yy_act )
  449.     { /* beginning of action switch */
  450. %% actions go here
  451.  
  452.     case YY_END_OF_BUFFER:
  453.         {
  454.         /* Amount of text matched not including the EOB char. */
  455.         int yy_amount_of_matched_text = yy_cp - yytext_ptr - 1;
  456.  
  457.         /* Undo the effects of YY_DO_BEFORE_ACTION. */
  458.         *yy_cp = yy_hold_char;
  459.  
  460.         if ( yy_current_buffer->yy_input_file != yyin )
  461.             {
  462.             /* This can happen if we scan a file, yywrap() returns
  463.              * 1, and then later the user points yyin at a new
  464.              * file to resume scanning.  We have to assure
  465.              * consistency between yy_current_buffer and our
  466.              * globals.  Here is the right place to do so, because
  467.              * this is the first action (other than possibly a
  468.              * back-up) that will match for the new input file.
  469.              */
  470.             yy_current_buffer->yy_input_file = yyin;
  471.             yy_n_chars = yy_current_buffer->yy_n_chars;
  472.             }
  473.  
  474.         /* Note that here we test for yy_c_buf_p "<=" to the position
  475.          * of the first EOB in the buffer, since yy_c_buf_p will
  476.          * already have been incremented past the NUL character
  477.          * (since all states make transitions on EOB to the
  478.          * end-of-buffer state).  Contrast this with the test
  479.          * in input().
  480.          */
  481.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  482.             { /* This was really a NUL. */
  483.             yy_state_type yy_next_state;
  484.  
  485.             yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
  486.  
  487.             yy_current_state = yy_get_previous_state();
  488.  
  489.             /* Okay, we're now positioned to make the NUL
  490.              * transition.  We couldn't have
  491.              * yy_get_previous_state() go ahead and do it
  492.              * for us because it doesn't know how to deal
  493.              * with the possibility of jamming (and we don't
  494.              * want to build jamming into it because then it
  495.              * will run more slowly).
  496.              */
  497.  
  498.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  499.  
  500.             yy_bp = yytext_ptr + YY_MORE_ADJ;
  501.  
  502.             if ( yy_next_state )
  503.                 {
  504.                 /* Consume the NUL. */
  505.                 yy_cp = ++yy_c_buf_p;
  506.                 yy_current_state = yy_next_state;
  507.                 goto yy_match;
  508.                 }
  509.  
  510.             else
  511.                 {
  512. %% code to do back-up for compressed tables and set up yy_cp goes here
  513.                 goto yy_find_action;
  514.                 }
  515.             }
  516.  
  517.         else switch ( yy_get_next_buffer() )
  518.             {
  519.             case EOB_ACT_END_OF_FILE:
  520.                 {
  521.                 yy_did_buffer_switch_on_eof = 0;
  522.  
  523.                 if ( yywrap() )
  524.                     {
  525.                     /* Note: because we've taken care in
  526.                      * yy_get_next_buffer() to have set up
  527.                      * yytext, we can now set up
  528.                      * yy_c_buf_p so that if some total
  529.                      * hoser (like flex itself) wants to
  530.                      * call the scanner after we return the
  531.                      * YY_NULL, it'll still work - another
  532.                      * YY_NULL will get returned.
  533.                      */
  534.                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  535.  
  536.                     yy_act = YY_STATE_EOF(YY_START);
  537.                     goto do_action;
  538.                     }
  539.  
  540.                 else
  541.                     {
  542.                     if ( ! yy_did_buffer_switch_on_eof )
  543.                         YY_NEW_FILE;
  544.                     }
  545.                 break;
  546.                 }
  547.  
  548.             case EOB_ACT_CONTINUE_SCAN:
  549.                 yy_c_buf_p =
  550.                     yytext_ptr + yy_amount_of_matched_text;
  551.  
  552.                 yy_current_state = yy_get_previous_state();
  553.  
  554.                 yy_cp = yy_c_buf_p;
  555.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  556.                 goto yy_match;
  557.  
  558.             case EOB_ACT_LAST_MATCH:
  559.                 yy_c_buf_p =
  560.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  561.  
  562.                 yy_current_state = yy_get_previous_state();
  563.  
  564.                 yy_cp = yy_c_buf_p;
  565.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  566.                 goto yy_find_action;
  567.             }
  568.         break;
  569.         }
  570.  
  571.     default:
  572.         YY_FATAL_ERROR(
  573.             "fatal flex scanner internal error--no action found" );
  574.     } /* end of action switch */
  575.         } /* end of scanning one token */
  576.     } /* end of yylex */
  577.  
  578. %+
  579. #ifdef YY_INTERACTIVE
  580. int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
  581. #else
  582. int yyFlexLexer::LexerInput( char* buf, int max_size )
  583. #endif
  584.     {
  585.     if ( yyin->eof() || yyin->fail() )
  586.         return 0;
  587.  
  588. #ifdef YY_INTERACTIVE
  589.     yyin->get( buf[0] );
  590.  
  591.     if ( yyin->eof() )
  592.         return 0;
  593.  
  594.     if ( yyin->bad() )
  595.         return -1;
  596.  
  597.     return 1;
  598.  
  599. #else
  600.     (void) yyin->read( buf, max_size );
  601.  
  602.     if ( yyin->bad() )
  603.         return -1;
  604.     else
  605.         return yyin->gcount();
  606. #endif
  607.     }
  608.  
  609. void yyFlexLexer::LexerOutput( const char* buf, int size )
  610.     {
  611.     (void) yyout->write( buf, size );
  612.     }
  613. %*
  614.  
  615. /* yy_get_next_buffer - try to read in a new buffer
  616.  *
  617.  * Returns a code representing an action:
  618.  *    EOB_ACT_LAST_MATCH -
  619.  *    EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  620.  *    EOB_ACT_END_OF_FILE - end of file
  621.  */
  622.  
  623. %-
  624. static int yy_get_next_buffer()
  625. %+
  626. int yyFlexLexer::yy_get_next_buffer()
  627. %*
  628.     {
  629.     register char *dest = yy_current_buffer->yy_ch_buf;
  630.     register char *source = yytext_ptr - 1; /* copy prev. char, too */
  631.     register int number_to_move, i;
  632.     int ret_val;
  633.  
  634.     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  635.         YY_FATAL_ERROR(
  636.         "fatal flex scanner internal error--end of buffer missed" );
  637.  
  638.     if ( yy_current_buffer->yy_fill_buffer == 0 )
  639.         { /* Don't try to fill the buffer, so this is an EOF. */
  640.         if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
  641.             {
  642.             /* We matched a singled characater, the EOB, so
  643.              * treat this as a final EOF.
  644.              */
  645.             return EOB_ACT_END_OF_FILE;
  646.             }
  647.  
  648.         else
  649.             {
  650.             /* We matched some text prior to the EOB, first
  651.              * process it.
  652.              */
  653.             return EOB_ACT_LAST_MATCH;
  654.             }
  655.         }
  656.  
  657.     /* Try to read more data. */
  658.  
  659.     /* First move last chars to start of buffer. */
  660.     number_to_move = yy_c_buf_p - yytext_ptr;
  661.  
  662.     for ( i = 0; i < number_to_move; ++i )
  663.         *(dest++) = *(source++);
  664.  
  665.     if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
  666.         /* don't do the read, it's not guaranteed to return an EOF,
  667.          * just force an EOF
  668.          */
  669.         yy_n_chars = 0;
  670.  
  671.     else
  672.         {
  673.         int num_to_read =
  674.             yy_current_buffer->yy_buf_size - number_to_move - 1;
  675.  
  676.         while ( num_to_read <= 0 )
  677.             { /* Not enough room in the buffer - grow it. */
  678. #ifdef YY_USES_REJECT
  679.             YY_FATAL_ERROR(
  680. "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
  681. #else
  682.  
  683.             /* just a shorter name for the current buffer */
  684.             YY_BUFFER_STATE b = yy_current_buffer;
  685.  
  686.             int yy_c_buf_p_offset = yy_c_buf_p - b->yy_ch_buf;
  687.  
  688.             b->yy_buf_size *= 2;
  689.             b->yy_ch_buf = (char *)
  690.                 yy_flex_realloc( (void *) b->yy_ch_buf,
  691.                          b->yy_buf_size );
  692.  
  693.             if ( ! b->yy_ch_buf )
  694.                 YY_FATAL_ERROR(
  695.                 "fatal error - scanner input buffer overflow" );
  696.  
  697.             yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
  698.  
  699.             num_to_read = yy_current_buffer->yy_buf_size -
  700.                         number_to_move - 1;
  701. #endif
  702.             }
  703.  
  704.         if ( num_to_read > YY_READ_BUF_SIZE )
  705.             num_to_read = YY_READ_BUF_SIZE;
  706.  
  707.         /* Read in more data. */
  708.         YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  709.             yy_n_chars, num_to_read );
  710.         }
  711.  
  712.     if ( yy_n_chars == 0 )
  713.         {
  714.         if ( number_to_move - YY_MORE_ADJ == 1 )
  715.             {
  716.             ret_val = EOB_ACT_END_OF_FILE;
  717.             yyrestart( yyin );
  718.             }
  719.  
  720.         else
  721.             {
  722.             ret_val = EOB_ACT_LAST_MATCH;
  723.             yy_current_buffer->yy_eof_status = EOF_PENDING;
  724.             }
  725.         }
  726.  
  727.     else
  728.         ret_val = EOB_ACT_CONTINUE_SCAN;
  729.  
  730.     yy_n_chars += number_to_move;
  731.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  732.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  733.  
  734.     /* yytext begins at the second character in yy_ch_buf; the first
  735.      * character is the one which preceded it before reading in the latest
  736.      * buffer; it needs to be kept around in case it's a newline, so
  737.      * yy_get_previous_state() will have with '^' rules active.
  738.      */
  739.  
  740.     yytext_ptr = &yy_current_buffer->yy_ch_buf[1];
  741.  
  742.     return ret_val;
  743.     }
  744.  
  745.  
  746. /* yy_get_previous_state - get the state just before the EOB char was reached */
  747.  
  748. %-
  749. static yy_state_type yy_get_previous_state()
  750. %+
  751. yy_state_type yyFlexLexer::yy_get_previous_state()
  752. %*
  753.     {
  754.     register yy_state_type yy_current_state;
  755.     register char *yy_cp;
  756.  
  757. %% code to get the start state into yy_current_state goes here
  758.  
  759.     for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  760.         {
  761. %% code to find the next state goes here
  762.         }
  763.  
  764.     return yy_current_state;
  765.     }
  766.  
  767.  
  768. /* yy_try_NUL_trans - try to make a transition on the NUL character
  769.  *
  770.  * synopsis
  771.  *    next_state = yy_try_NUL_trans( current_state );
  772.  */
  773.  
  774. %-
  775. #ifdef YY_USE_PROTOS
  776. static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
  777. #else
  778. static yy_state_type yy_try_NUL_trans( yy_current_state )
  779. yy_state_type yy_current_state;
  780. #endif
  781. %+
  782. yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
  783. %*
  784.     {
  785.     register int yy_is_jam;
  786. %% code to find the next state, and perhaps do backing up, goes here
  787.  
  788.     return yy_is_jam ? 0 : yy_current_state;
  789.     }
  790.  
  791.  
  792. %-
  793. #ifdef YY_USE_PROTOS
  794. static void yyunput( int c, register char *yy_bp )
  795. #else
  796. static void yyunput( c, yy_bp )
  797. int c;
  798. register char *yy_bp;
  799. #endif
  800. %+
  801. void yyFlexLexer::yyunput( int c, register char* yy_bp )
  802. %*
  803.     {
  804.     register char *yy_cp = yy_c_buf_p;
  805.  
  806.     /* undo effects of setting up yytext */
  807.     *yy_cp = yy_hold_char;
  808.  
  809.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  810.         { /* need to shift things up to make room */
  811.         /* +2 for EOB chars. */
  812.         register int number_to_move = yy_n_chars + 2;
  813.         register char *dest = &yy_current_buffer->yy_ch_buf[
  814.                     yy_current_buffer->yy_buf_size + 2];
  815.         register char *source =
  816.                 &yy_current_buffer->yy_ch_buf[number_to_move];
  817.  
  818.         while ( source > yy_current_buffer->yy_ch_buf )
  819.             *--dest = *--source;
  820.  
  821.         yy_cp += dest - source;
  822.         yy_bp += dest - source;
  823.         yy_n_chars = yy_current_buffer->yy_buf_size;
  824.  
  825.         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  826.             YY_FATAL_ERROR( "flex scanner push-back overflow" );
  827.         }
  828.  
  829.     if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
  830.         yy_cp[-2] = '\n';
  831.  
  832.     *--yy_cp = (char) c;
  833.  
  834. %% update yylineno here, if doing -l
  835.  
  836.     /* Note: the formal parameter *must* be called "yy_bp" for this
  837.      * macro to now work correctly.
  838.      */
  839.     YY_DO_BEFORE_ACTION; /* set up yytext again */
  840.     }
  841.  
  842.  
  843. %-
  844. #ifdef __cplusplus
  845. static int yyinput()
  846. #else
  847. static int input()
  848. #endif
  849. %+
  850. int yyFlexLexer::yyinput()
  851. %*
  852.     {
  853.     int c;
  854.  
  855.     *yy_c_buf_p = yy_hold_char;
  856.  
  857.     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  858.         {
  859.         /* yy_c_buf_p now points to the character we want to return.
  860.          * If this occurs *before* the EOB characters, then it's a
  861.          * valid NUL; if not, then we've hit the end of the buffer.
  862.          */
  863.         if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  864.             /* This was really a NUL. */
  865.             *yy_c_buf_p = '\0';
  866.  
  867.         else
  868.             { /* need more input */
  869.             yytext_ptr = yy_c_buf_p;
  870.             ++yy_c_buf_p;
  871.  
  872.             switch ( yy_get_next_buffer() )
  873.                 {
  874.                 case EOB_ACT_END_OF_FILE:
  875.                     {
  876.                     if ( yywrap() )
  877.                         {
  878.                         yy_c_buf_p =
  879.                         yytext_ptr + YY_MORE_ADJ;
  880.                         return EOF;
  881.                         }
  882.  
  883.                     YY_NEW_FILE;
  884. #ifdef __cplusplus
  885.                     return yyinput();
  886. #else
  887.                     return input();
  888. #endif
  889.                     }
  890.  
  891.                 case EOB_ACT_CONTINUE_SCAN:
  892.                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  893.                     break;
  894.  
  895.                 case EOB_ACT_LAST_MATCH:
  896. #ifdef __cplusplus
  897.                     YY_FATAL_ERROR(
  898.                     "unexpected last match in yyinput()" );
  899. #else
  900.                     YY_FATAL_ERROR(
  901.                     "unexpected last match in input()" );
  902. #endif
  903.                 }
  904.             }
  905.         }
  906.  
  907.     c = *yy_c_buf_p;
  908.     *yy_c_buf_p = '\0';    /* preserve yytext */
  909.     yy_hold_char = *++yy_c_buf_p;
  910.  
  911.     return c;
  912.     }
  913.  
  914.  
  915. %-
  916. #ifdef YY_USE_PROTOS
  917. void yyrestart( FILE *input_file )
  918. #else
  919. void yyrestart( input_file )
  920. FILE *input_file;
  921. #endif
  922. %+
  923. void yyFlexLexer::yyrestart( istream* input_file )
  924. %*
  925.     {
  926.     if ( ! yy_current_buffer )
  927.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  928.  
  929.     yy_init_buffer( yy_current_buffer, input_file );
  930.     yy_load_buffer_state();
  931.     }
  932.  
  933.  
  934. %-
  935. #ifdef YY_USE_PROTOS
  936. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  937. #else
  938. void yy_switch_to_buffer( new_buffer )
  939. YY_BUFFER_STATE new_buffer;
  940. #endif
  941. %+
  942. void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  943. %*
  944.     {
  945.     if ( yy_current_buffer == new_buffer )
  946.         return;
  947.  
  948.     if ( yy_current_buffer )
  949.         {
  950.         /* Flush out information for old buffer. */
  951.         *yy_c_buf_p = yy_hold_char;
  952.         yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  953.         yy_current_buffer->yy_n_chars = yy_n_chars;
  954.         }
  955.  
  956.     yy_current_buffer = new_buffer;
  957.     yy_load_buffer_state();
  958.  
  959.     /* We don't actually know whether we did this switch during
  960.      * EOF (yywrap()) processing, but the only time this flag
  961.      * is looked at is after yywrap() is called, so it's safe
  962.      * to go ahead and always set it.
  963.      */
  964.     yy_did_buffer_switch_on_eof = 1;
  965.     }
  966.  
  967.  
  968. %-
  969. #ifdef YY_USE_PROTOS
  970. void yy_load_buffer_state( void )
  971. #else
  972. void yy_load_buffer_state()
  973. #endif
  974. %+
  975. void yyFlexLexer::yy_load_buffer_state()
  976. %*
  977.     {
  978.     yy_n_chars = yy_current_buffer->yy_n_chars;
  979.     yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  980.     yyin = yy_current_buffer->yy_input_file;
  981.     yy_hold_char = *yy_c_buf_p;
  982.     }
  983.  
  984.  
  985. %-
  986. #ifdef YY_USE_PROTOS
  987. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  988. #else
  989. YY_BUFFER_STATE yy_create_buffer( file, size )
  990. FILE *file;
  991. int size;
  992. #endif
  993. %+
  994. YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
  995. %*
  996.     {
  997.     YY_BUFFER_STATE b;
  998.  
  999.     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
  1000.  
  1001.     if ( ! b )
  1002.         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1003.  
  1004.     b->yy_buf_size = size;
  1005.  
  1006.     /* yy_ch_buf has to be 2 characters longer than the size given because
  1007.      * we need to put in 2 end-of-buffer characters.
  1008.      */
  1009.     b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
  1010.  
  1011.     if ( ! b->yy_ch_buf )
  1012.         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1013.  
  1014.     yy_init_buffer( b, file );
  1015.  
  1016.     return b;
  1017.     }
  1018.  
  1019.  
  1020. %-
  1021. #ifdef YY_USE_PROTOS
  1022. void yy_delete_buffer( YY_BUFFER_STATE b )
  1023. #else
  1024. void yy_delete_buffer( b )
  1025. YY_BUFFER_STATE b;
  1026. #endif
  1027. %+
  1028. void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
  1029. %*
  1030.     {
  1031.     if ( b == yy_current_buffer )
  1032.         yy_current_buffer = (YY_BUFFER_STATE) 0;
  1033.  
  1034.     yy_flex_free( (void *) b->yy_ch_buf );
  1035.     yy_flex_free( (void *) b );
  1036.     }
  1037.  
  1038.  
  1039. %-
  1040. #ifdef YY_USE_PROTOS
  1041. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  1042. #else
  1043. void yy_init_buffer( b, file )
  1044. YY_BUFFER_STATE b;
  1045. FILE *file;
  1046. #endif
  1047. %+
  1048. void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
  1049. %*
  1050.     {
  1051.     b->yy_input_file = file;
  1052.  
  1053.     /* We put in the '\n' and start reading from [1] so that an
  1054.      * initial match-at-newline will be true.
  1055.      */
  1056.  
  1057.     b->yy_ch_buf[0] = '\n';
  1058.     b->yy_n_chars = 1;
  1059.  
  1060.     /* We always need two end-of-buffer characters.  The first causes
  1061.      * a transition to the end-of-buffer state.  The second causes
  1062.      * a jam in that state.
  1063.      */
  1064.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1065.     b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
  1066.  
  1067.     b->yy_buf_pos = &b->yy_ch_buf[1];
  1068.  
  1069. %-
  1070.     b->yy_is_interactive = file ? isatty( fileno(file) ) : 0;
  1071. %+
  1072.     b->yy_is_interactive = 0;
  1073. %*
  1074.  
  1075.     b->yy_fill_buffer = 1;
  1076.  
  1077.     b->yy_eof_status = EOF_NOT_SEEN;
  1078.     }
  1079.  
  1080.  
  1081. %-
  1082. #ifdef YY_USE_PROTOS
  1083. static void yy_push_state( int new_state )
  1084. #else
  1085. static void yy_push_state( new_state )
  1086. int new_state;
  1087. #endif
  1088. %+
  1089. void yyFlexLexer::yy_push_state( int new_state )
  1090. %*
  1091.     {
  1092.     if ( yy_start_stack_ptr >= yy_start_stack_depth )
  1093.         {
  1094.         int new_size;
  1095.  
  1096.         yy_start_stack_depth += YY_START_STACK_INCR;
  1097.         new_size = yy_start_stack_depth * sizeof( int );
  1098.  
  1099.         if ( ! yy_start_stack )
  1100.             yy_start_stack = (int *) yy_flex_alloc( new_size );
  1101.  
  1102.         else
  1103.             yy_start_stack = (int *) yy_flex_realloc(
  1104.                     (void *) yy_start_stack, new_size );
  1105.  
  1106.         if ( ! yy_start_stack )
  1107.             YY_FATAL_ERROR(
  1108.             "out of memory expanding start-condition stack" );
  1109.         }
  1110.  
  1111.     yy_start_stack[yy_start_stack_ptr++] = YY_START;
  1112.  
  1113.     BEGIN(new_state);
  1114.     }
  1115.  
  1116.  
  1117. %-
  1118. static void yy_pop_state()
  1119. %+
  1120. void yyFlexLexer::yy_pop_state()
  1121. %*
  1122.     {
  1123.     if ( --yy_start_stack_ptr < 0 )
  1124.         YY_FATAL_ERROR( "start-condition stack underflow" );
  1125.  
  1126.     BEGIN(yy_start_stack[yy_start_stack_ptr]);
  1127.     }
  1128.  
  1129.  
  1130. %-
  1131. static int yy_top_state()
  1132. %+
  1133. int yyFlexLexer::yy_top_state()
  1134. %*
  1135.     {
  1136.     return yy_start_stack[yy_start_stack_ptr - 1];
  1137.     }
  1138.  
  1139.  
  1140. %-
  1141. #ifdef YY_USE_PROTOS
  1142. static void yy_fatal_error( const char msg[] )
  1143. #else
  1144. static void yy_fatal_error( msg )
  1145. char msg[];
  1146. #endif
  1147.     {
  1148.     (void) fprintf( stderr, "%s\n", msg );
  1149.     exit( 1 );
  1150.     }
  1151.  
  1152. %+
  1153.  
  1154. void yyFlexLexer::LexerError( const char msg[] )
  1155.     {
  1156.     cerr << msg << '\n';
  1157.     exit( 1 );
  1158.     }
  1159. %*
  1160.  
  1161.  
  1162. /* Redefine yyless() so it works in section 3 code. */
  1163.  
  1164. #undef yyless
  1165. #define yyless(n) \
  1166.     do \
  1167.         { \
  1168.         /* Undo effects of setting up yytext. */ \
  1169.         yytext[yyleng] = yy_hold_char; \
  1170.         yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
  1171.         yy_hold_char = *yy_c_buf_p; \
  1172.         *yy_c_buf_p = '\0'; \
  1173.         yyleng = n; \
  1174.         } \
  1175.     while ( 0 )
  1176.  
  1177.  
  1178. /* Internal utility routines. */
  1179.  
  1180. #ifndef yytext_ptr
  1181. #ifdef YY_USE_PROTOS
  1182. static void yy_flex_strcpy( char *s1, const char *s2 )
  1183. #else
  1184. static void yy_flex_strcpy( s1, s2 )
  1185. char *s1;
  1186. const char *s2;
  1187. #endif
  1188.     {
  1189.     while ( (*(s1++) = *(s2++)) )
  1190.         ;
  1191.     }
  1192. #endif
  1193.  
  1194.  
  1195. #ifdef YY_USE_PROTOS
  1196. static void *yy_flex_alloc( unsigned int size )
  1197. #else
  1198. static void *yy_flex_alloc( size )
  1199. unsigned int size;
  1200. #endif
  1201.     {
  1202.     return (void *) malloc( size );
  1203.     }
  1204.  
  1205. #ifdef YY_USE_PROTOS
  1206. static void *yy_flex_realloc( void *ptr, unsigned int size )
  1207. #else
  1208. static void *yy_flex_realloc( ptr, size )
  1209. void *ptr;
  1210. unsigned int size;
  1211. #endif
  1212.     {
  1213.     return (void *) realloc( ptr, size );
  1214.     }
  1215.  
  1216. #ifdef YY_USE_PROTOS
  1217. static void yy_flex_free( void *ptr )
  1218. #else
  1219. static void yy_flex_free( ptr )
  1220. void *ptr;
  1221. #endif
  1222.     {
  1223.     free( ptr );
  1224.     }
  1225.